import 'package:flutter/material.dart';
import 'package:vmall_app/assets/icon_font.dart';

class CartButton extends StatelessWidget {
  final int count;

  const CartButton({Key key, this.count}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Align(
            alignment: Alignment.center,
            child: Container(
              width: 25,
              height: 25,
              padding: const EdgeInsets.all(2),
              decoration: BoxDecoration(
                  color: Colors.black26,
                  borderRadius: BorderRadius.circular(20)),
              child: Icon(
                Iconfont.cart_light,
                color: Colors.white,
                size: 20,
              ),
            )),
        Positioned(
          right: 0,
          top: 10,
          child: Container(
            decoration: BoxDecoration(
                color: Colors.red, borderRadius: BorderRadius.circular(10)),
            child: Padding(
              padding: const EdgeInsets.all(3.0),
              child: Text(
                this.count.toString(),
                style: TextStyle(fontSize: 9),
              ),
            ),
          ),
        ),
      ],
    );
  }
}
